#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char* bitmap;
void bit_show(char id);

void bit_set_0(int id)
{
	int bit_id=id/8;
	int bit_mod=id%8;
	char p=(int) (1<<bit_mod)&0xff;  /* 0010 0000 */
	//printf ("%d  ",bit_mod); bit_show(p);

	p=~p;  /* 1101 1111 */
	//bit_show(p);

	bitmap[bit_id]&=p;
}

int main()
{
	int cnt,i,fd;
	int disk_location, disk_length;

	bitmap=malloc(8*1024*1024);
	memset(bitmap, -1, sizeof(bitmap));
	scanf ("%d",&cnt);
	while (cnt--)
	{
		scanf ("%d %d", &disk_location, &disk_length);
		for (i=disk_location; i<disk_location+disk_length; i++) bit_set_0(i);
		printf ("\n\n");
		bit_show(bitmap[disk_location/8-1]);
		bit_show(bitmap[disk_location/8]);
		bit_show(bitmap[disk_location/8+1]);
	}

	fd=open("bitmap_result", O_RDWR | O_CREAT , S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
	write(fd, bitmap, 8*1024*1024);

	close(fd);
	free(bitmap);
	return 0;
}


void bit_show(char num)
{
	int i;
	for (i=0; i<8; i++)
	{
		if ((num&(1<<i))==0)	printf("0");
		else printf ("1");
	}
	printf ("\n");
}
